
scalar in_pop = 6.7e6
use health/inp_clean , clear
keep if inrange(admit_date,`=mdy(1,1,2020)',`=mdy(12,22,2020)')		

egen week = cut(admit_date), at(`=mdy(1,1,2020)'(7)`=mdy(12,22,2020)')			

gen has_dx = ~no_dx
gen icli1 = any_icli if has_dx
gen icli2  = any_icli == 1 | no_dx
gen any = 1
collapse (sum)  has_dx icli1 icli2 any, by(week)

gen share1 = (icli1/has_dx)*any / in_pop * 100
gen share2 = icli2/in_pop * 100

sum share1 share2

format week %td
# delimit ;
twoway
	(line share2 week if ~missing(share2))
	(line share1 week if ~missing(share2), lpattern(dash))
	,
	graphregion(color(white))
	xtitle("Week") ytitle("") 
	title("%", span position(11))
	ylabel(0(0.1)0.5)
	xlabel(`=mdy(1,1,2020)' "1/1" `=mdy(4,1,2020)' "4/1" 
		`=mdy(7,1,2020)' "7/1" `=mdy(10,1,2020)' "10/1")
	legend(ring(0) pos(2) cols(1) order(1 "Upper bound" 2 "Based on observed diagnosis"))
;
# delimit cr
graph export figures/icli_hosp_rate.pdf, replace 
	
